const express = require('express');
const router = express.Router();

// V1 Controllers
const userController = require('../../modules/user/v1/user.controller');

/**
 * API Version 1.0 Routes
 * Legacy API endpoints for backward compatibility
 */

// Version info endpoint
router.get('/', (req, res) => {
  res.json({
    version: '1.0',
    status: 'deprecated',
    message: 'API v1 is deprecated. Please migrate to v2.',
    deprecationDate: '2024-01-01',
    sunsetDate: '2024-12-31',
    migration: {
      guide: '/docs/migration/v1-to-v2',
      breaking_changes: [
        'User response format changed',
        'Authentication token format updated',
        'Error response structure modified'
      ]
    }
  });
});

// User routes
router.use('/users', userController);

// Add deprecation warning middleware for all v1 routes
router.use('*', (req, res, next) => {
  res.set({
    'X-API-Version': '1.0',
    'X-API-Deprecated': 'true',
    'X-API-Sunset': '2024-12-31',
    'X-API-Migration-Guide': 'https://docs.example.com/migration/v1-to-v2'
  });
  next();
});

module.exports = router;